/*
 * @Author: 9ilk 3535851673@qq.com
 * @Date: 2024-11-08 10:46:36
 * @LastEditors: 9ilk 3535851673@qq.com
 * @LastEditTime: 2024-11-08 10:55:23
 * @FilePath: /zhuang/sharemem/time.hpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#pragma once
#include <iostream>
#include <string>
#include <ctime>
using namespace std;

string GetCurrTime()
{
    time_t t = time(nullptr); // 获取时间戳
    struct tm *curr = ::localtime(&t);
    // 获取时间信息
    char currtime[32];
    snprintf(currtime, sizeof(currtime), "%d-%d-%d  %d:%d:%d",
             curr->tm_year+1900,
             curr->tm_mon+1,
             curr->tm_mday,
             curr->tm_hour,
             curr->tm_min,
             curr->tm_sec);
    return currtime;         
}
